﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MovieRental.BuisnessComponents.Helpers
{
    public class ValueBound<T> where T : IComparable<T>
    {
        public T Lower { private set; get; }

        public T Upper { private set; get; }

        public ValueBound(T lower, T upper)
        {
            int x = upper.CompareTo(lower);
            if (upper.CompareTo(lower) < 0)
                throw new ArgumentException();
            Lower = lower;
            Upper = upper;
        }

        public bool IsInBounds(T value)
        {
            return (value.CompareTo(Lower) > 0 && value.CompareTo(Upper) < 0);
        }
    }
}
